'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')
const urlPrix="/api"
const devEnv = require('./dev.env')

module.exports = {
  dev: {
    // Paths
    assetsSubDirectory: "static",
    // assetsPublicPath: "/",
    assetsPublicPath: `${devEnv.VUE_APP_BASE_URL_PC.replace(/"/g, '')}${devEnv.VUE_APP_VERSION_PC.replace(/"/g, '')}/`,
    // assetsPublicPath: `/upgrade/`,
    proxyTable: {
      // 文件上传代理
      "/roche2/api": {
        // target: 'http://172.29.96.20:9020/', // 何天琦本地
        // target: 'http://172.29.96.19:9020/', // 胡孟本地
        // target: 'https://medchat.yuemia.com/', // 正式环境
        target: 'http://test.saas.yuemia.com/', // 
        changeOrigin: true,
        secure: false
      },
      "/ops/api": {
        // target: 'http://test.market.yuemia.com:8101/',
        // target: 'http://172.29.96.45:9006/', // 何天琦本地
        // target: 'http://172.29.96.19:9006/', // 胡孟本地
        // target: 'http://172.29.96.138:9195/', // 线上
        // target: 'http://172.29.96.50:9195/', // 沈为涛本地
        // target: 'http://172.29.96.188:9195/', // 周哥本地
        // target: 'http://172.29.95.138:8101/', // 内网域名ip
        target: 'http://test.saas.yuemia.com/', // 正式环境
        changeOrigin: true,
        secure: false
        // pathRewrite: {
        //   '^/ops/api': ''
        // }
      },
      '/oss': {
        target: 'http://172.29.95.138:8001',
        changeOrigin: true,
        secure: false
      }
    },
    // Various Dev Server settings
    host: "localhost", // can be overwritten by process.env.HOST
    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: true,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    devtool: "cheap-module-eval-source-map",

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    cssSourceMap: true
  },
  build: {
    // Template for index.html
    index: path.resolve(__dirname, "../adminConsole/index.html"),

    // Paths
    assetsRoot: path.resolve(__dirname, "../adminConsole"),
    assetsSubDirectory: "static",
    assetsPublicPath:  `${devEnv.VUE_APP_BASE_URL_PC.replace(/"/g, '')}${devEnv.VUE_APP_VERSION_PC.replace(/"/g, '')}/`,
    // assetsPublicPath: `/upgrade/`,

    /**
     * Source Maps
     */

    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: "#source-map",

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: true,
    productionGzipExtensions: ["js", "css"],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
};
